package pratica07;

/**
 *
 * @author elias
 */
public class Factory {

    private static Factory factory = null;
    private static boolean created = false;

    private Factory(){
        
    }

    public static Factory getInstance(){
        if ( !created ){
            created = true;
            factory = new Factory();
        }
        return factory;
    }

    public AbstractFactory fabricar(String name){
        return ( name.equals("mcdonalds") ? new McDonalds():(name.equals("burgerking") ? new BurgerKing(): new Giraffas()));
    }

}
